package manong.mapper;

import manong.beans.Course;
import manong.beans.CourseQuery;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.session.RowBounds;

import java.util.List;
@Mapper
public interface CourseMapper {
  
    long countByExample(CourseQuery example);

    
    int deleteByExample(CourseQuery example);

   
    @Delete({
        "delete from course",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    
    @Insert({
        "insert into course (course_name, course_time, ",
        "statu, mark)",
        "values (#{courseName,jdbcType=VARCHAR}, #{courseTime,jdbcType=INTEGER}, ",
        "#{statu,jdbcType=INTEGER}, #{mark,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(Course record);

    int insertSelective(Course record);

    List<Course> selectByExampleWithRowbounds(CourseQuery example, RowBounds rowBounds);

   
    Course selectOneByExample(CourseQuery example);

 
    List<Course> selectByExample(CourseQuery example);

 
    @Select({
        "select",
        "id, course_name, course_time, statu, mark",
        "from course",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("manong.mapper.CourseMapper.BaseResultMap")
    Course selectByPrimaryKey(Integer id);

   
    int updateByExampleSelective(@Param("record") Course record, @Param("example") CourseQuery example);

  
    int updateByExample(@Param("record") Course record, @Param("example") CourseQuery example);

   
    int updateByPrimaryKeySelective(Course record);

  
    @Update({
        "update course",
        "set course_name = #{courseName,jdbcType=VARCHAR},",
          "course_time = #{courseTime,jdbcType=INTEGER},",
          "statu = #{statu,jdbcType=INTEGER},",
          "mark = #{mark,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Course record);

   
    int insertOrUpdate(Course record);

   
    int insertOrUpdateSelective(Course record);

  
    int batchInsert(@Param("list") List<Course> list);

   
    int batchInsertSelective(@Param("list") List<Course> list, @Param("selective") Course.Column ... selective);
}